﻿using System;
using Gumini.JulaDB.Enums;

namespace Gumini.JulaDB.Provider
{
    public class JulaDbException : Exception
    {
        public JulaDbException(ErrorCode errorCode, SourcePosition position, string message, params object[] args)
            : base(String.Format("Error {0}: {1}", errorCode, String.Format(message, args)))
        {
            this.ErrorCode = errorCode;
            this.Position = position;
        }

        public JulaDbException(ErrorCode errorCode, string message, params object[] args) :
            this(errorCode, null, message, args) { }

        public ErrorCode ErrorCode { get; private set; }

        public SourcePosition Position { get; internal set; }
    }
}
